#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: build_task_node.py 
@version:
@time: 2022/07/13 
"""
from TapDevops.build_jenkins.build_local import BuildLocal


class BuildTaskNode(BuildLocal):

    def field_rename_task(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'keep_initial':
            title = self.title_field_rename_keep_initial
            path = self.path_field_rename_keep_initial
        elif _type == 'keep_cdc':
            title = self.title_field_rename_keep_cdc
            path = self.path_field_rename_keep_cdc
        elif _type == 'keep_initial_cdc':
            title = self.title_field_rename_keep_initial_cdc
            path = self.path_field_rename_keep_initial_cdc
        # rename
        elif _type == 'rename_initial':
            title = self.title_field_rename_initial
            path = self.path_field_rename_initial
        # upper
        elif _type == 'upper_initial':
            title = self.title_field_rename_upper_initial
            path = self.path_field_rename_upper_initial
        elif _type == 'upper_cdc':
            title = self.title_field_rename_upper_cdc
            path = self.path_field_rename_upper_cdc
        elif _type == 'upper_initial_cdc':
            title = self.title_field_rename_upper_initial_cdc
            path = self.path_field_rename_upper_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def add_delete_field_task(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'keep_initial':
            title = self.title_add_delete_field_keep_initial
            path = self.path_add_delete_field_keep_initial
        elif _type == 'keep_cdc':
            title = self.title_add_delete_field_keep_cdc
            path = self.path_add_delete_field_keep_cdc
        elif _type == 'keep_initial_cdc':
            title = self.title_add_delete_field_keep_initial_cdc
            path = self.path_add_delete_field_keep_initial_cdc
        # add
        elif _type == 'add_initial':
            title = self.title_add_field_initial
            path = self.path_add_field_initial
        elif _type == 'add_cdc':
            title = self.title_add_field_cdc
            path = self.path_add_field_cdc
        elif _type == 'add_initial_cdc':
            title = self.title_add_field_initial_cdc
            path = self.path_add_field_initial_cdc
        # delete
        elif _type == 'delete_initial':
            title = self.title_delete_field_initial
            path = self.path_delete_field_initial
        elif _type == 'delete_cdc':
            title = self.title_delete_field_cdc
            path = self.path_delete_field_cdc
        elif _type == 'delete_initial_cdc':
            title = self.title_delete_field_initial_cdc
            path = self.path_delete_field_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def left_join_task(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'initial':
            title = self.title_add_delete_field_keep_initial
            path = self.path_add_delete_field_keep_initial
        elif _type == 'cdc':
            title = self.title_add_delete_field_keep_cdc
            path = self.path_add_delete_field_keep_cdc
        elif _type == 'initial_cdc':
            title = self.title_add_delete_field_keep_initial_cdc
            path = self.path_add_delete_field_keep_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def type_change(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'keep_initial':
            title = self.title_type_change_keep_initial
            path = self.path_type_change_keep_initial
        elif _type == 'keep_cdc':
            title = self.title_type_change_keep_cdc
            path = self.path_type_change_keep_cdc
        elif _type == 'keep_initial_cdc':
            title = self.title_type_change_keep_initial_cdc
            path = self.path_type_change_keep_initial_cdc
        elif _type == 'change_1_initial':
            title = self.title_type_change_1_initial
            path = self.path_type_change_1_initial
        elif _type == 'change_1_cdc':
            title = self.title_type_change_1_cdc
            path = self.path_type_change_1_cdc
        elif _type == 'change_1_initial_cdc':
            title = self.title_type_change_1_initial_cdc
            path = self.path_type_change_1_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def field_calculation(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'keep_initial':
            title = self.title_field_calculation_keep_initial
            path = self.path_field_calculation_keep_initial
        elif _type == 'keep_cdc':
            title = self.title_field_calculation_keep_cdc
            path = self.path_field_calculation_keep_cdc
        elif _type == 'keep_initial_cdc':
            title = self.title_field_calculation_keep_initial_cdc
            path = self.path_field_calculation_keep_initial_cdc
        elif _type == 'title_initial':
            title = self.title_field_calculation_change_initial
            path = self.path_field_calculation_change_initial
        elif _type == 'title_cdc':
            title = self.title_field_calculation_change_cdc
            path = self.path_field_calculation_change_cdc
        elif _type == 'title_initial_cdc':
            title = self.title_field_calculation_change_initial_cdc
            path = self.path_field_calculation_change_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def merge(self, _type):
        title = ''
        path = ''
        # one2more
        if _type == 'one2more_initial':
            title = self.title_one2more_initial
            path = self.path_one2more_initial
        elif _type == 'one2more_cdc':
            title = self.title_one2more_cdc
            path = self.path_one2more_cdc
        elif _type == 'one2more_initial_cdc':
            title = self.title_one2more_initial_cdc
            path = self.path_one2more_initial_cdc
        elif _type == 'more2one_initial':
            title = self.title_more2one_initial
            path = self.path_more2one_initial
        elif _type == 'more2one_cdc':
            title = self.title_more2one_cdc
            path = self.path_more2one_cdc
        elif _type == 'more2one_initial_cdc':
            title = self.title_more2one_initial_cdc
            path = self.path_more2one_initial_cdc
        elif _type == 'one2more2one_initial':
            title = self.title_one2more2one_initial
            path = self.path_one2more2one_initial
        elif _type == 'one2more2one_cdc':
            title = self.title_one2more2one_cdc
            path = self.path_one2more2one_cdc
        elif _type == 'one2more2one_initial_cdc':
            title = self.title_one2more2one_initial_cdc
            path = self.path_one2more2one_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def aggregation(self, _type):
        title = ''
        path = ''
        # avg
        if _type == 'avg_initial':
            title = self.title_avg_initial
            path = self.path_avg_initial
        elif _type == 'avg_cdc':
            title = self.title_avg_cdc
            path = self.path_avg_cdc
        elif _type == 'avg_initial_cdc':
            title = self.title_avg_initial_cdc
            path = self.path_avg_initial_cdc
        # count
        elif _type == 'count_initial':
            title = self.title_count_initial
            path = self.path_count_initial
        elif _type == 'count_cdc':
            title = self.title_count_cdc
            path = self.path_count_cdc
        elif _type == 'count_initial_cdc':
            title = self.title_count_initial_cdc
            path = self.path_count_initial_cdc
        # max
        elif _type == 'max_initial':
            title = self.title_max_initial
            path = self.path_max_initial
        elif _type == 'max_cdc':
            title = self.title_max_cdc
            path = self.path_max_cdc
        elif _type == 'max_initial_cdc':
            title = self.title_max_initial_cdc
            path = self.path_max_initial_cdc
        # min
        elif _type == 'min_initial':
            title = self.title_min_initial
            path = self.path_min_initial
        elif _type == 'min_cdc':
            title = self.title_min_cdc
            path = self.path_min_cdc
        elif _type == 'min_initial_cdc':
            title = self.title_min_initial_cdc
            path = self.path_min_initial_cdc
        # sum
        elif _type == 'sum_initial':
            title = self.title_sum_initial
            path = self.path_sum_initial
        elif _type == 'sum_cdc':
            title = self.title_sum_cdc
            path = self.path_sum_cdc
        elif _type == 'sum_initial_cdc':
            title = self.title_sum_initial_cdc
            path = self.path_sum_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def js_and_cache(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'initial':
            title = self.title_js_common_initial
            path = self.path_js_common_initial
        elif _type == 'cdc':
            title = self.title_js_common_cdc
            path = self.path_js_common_cdc
        elif _type == 'initial_cdc':
            title = self.title_js_common_initial_cdc
            path = self.path_js_common_initial_cdc
        elif _type == 'cache_initial':
            title = self.title_js_cache_initial
            path = self.path_js_cache_initial
        elif _type == 'cache_cdc':
            title = self.title_js_cache_cdc
            path = self.path_js_cache_cdc
        elif _type == 'cache_initial_cdc':
            title = self.title_js_cache_initial_cdc
            path = self.path_js_cache_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def js_func(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'custom_initial':
            title = self.title_js_custom_initial
            path = self.path_js_custom_initial
        elif _type == 'jar_initial':
            title = self.title_js_jar_initial
            path = self.path_js_jar_initial
        elif _type == 'sys_initial':
            title = self.title_js_sys_initial
            path = self.path_js_sys_initial
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def custom_node(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'initial':
            title = self.title_custom_node_initial
            path = self.path_custom_node_initial
        elif _type == 'cdc':
            title = self.title_custom_node_cdc
            path = self.path_custom_node_cdc
        elif _type == 'initial_cdc':
            title = self.title_custom_node_initial_cdc
            path = self.path_custom_node_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )

    def row_filter_task(self, _type):
        title = ''
        path = ''
        # keep
        if _type == 'keep_initial':
            title = self.title_rowfilter_keep_initial
            path = self.path_rowfilter_keep_initial
        elif _type == 'keep_cdc':
            title = self.title_rowfilter_keep_cdc
            path = self.path_rowfilter_keep_cdc
        elif _type == 'keep_initial_cdc':
            title = self.title_rowfilter_keep_initial_cdc
            path = self.path_rowfilter_keep_initial_cdc
        # filter01
        elif _type == 'filter01_initial':
            title = self.title_rowfilter_01_initial
            path = self.path_rowfilter_01_initial
        elif _type == 'filter01_cdc':
            title = self.title_rowfilter_01_cdc
            path = self.path_rowfilter_01_cdc
        elif _type == 'filter01_initial_cdc':
            title = self.title_rowfilter_01_initial_cdc
            path = self.path_rowfilter_01_initial_cdc
        data = self.common_build(
            title,
            path
        )
        self.build(
            data
        )
